<?php
/**
 * Object Main_Quote
 * @author SillySmart
 * @copyright SillySmart
 * @package Mvc.Models.Objects
 * @see Sls.Models.Core.SLS_FrontModel
 * @since 1.0
 */
class Main_Quote extends SLS_FrontModel
{
	/**
	 * Class variables
	 */
	protected $__quote_id;
	protected $__pk_lang;
	protected $__quote_author;
	protected $__quote_content;
	protected $_table = "quote";
	protected $_db = "main";
	protected $_primaryKey = "quote_id";
	protected $_fks = array();
	public $_typeErrors = array();

	/**
	 * Constructor Main_Quote
	 * @author SillySmart
	 * @copyright SillySmart
	 * @param bool $mutlilanguage true if multilanguage content, else false
	 */
	public function __construct($multilanguage=true)
	{
		parent::__construct($multilanguage);
		$this->buildDefaultValues();
	}

	/**
	 * Build default values for specific columns
	 * @author SillySmart
	 * @copyright SillySmart
	 */
	public function buildDefaultValues()
	{
	}

	/**
	 * Set the value of quote_author
	 * Errors can be catched with the public variable $this->_typeErrors['quote_author']
	 * @author SillySmart
	 * @copyright SillySmart
	 * @param string $value
	 * @return bool true if updated, false if not
	 */
	public function setQuoteAuthor($value)
	{
		if ($value === "")
		{
			$this->_typeErrors['quote_author'] = "E_EMPTY";
			return false;
		}

		if (is_null($value))
		{
			$this->_typeErrors['quote_author'] = "E_NULL";
			return false;
		}

		if ($this->__quote_author == $value)
			return true;

		if (strlen($value) > 127)
		{
			$this->_typeErrors['quote_author'] = "E_LENGTH";
			return false;
		}

		$this->__set('quote_author', $value);
		return true;
	}

	/**
	 * Set the value of quote_content
	 * Errors can be catched with the public variable $this->_typeErrors['quote_content']
	 * @author SillySmart
	 * @copyright SillySmart
	 * @param string $value
	 * @return bool true if updated, false if not
	 */
	public function setQuoteContent($value)
	{
		if ($value === "")
		{
			$this->_typeErrors['quote_content'] = "E_EMPTY";
			return false;
		}

		if (is_null($value))
		{
			$this->_typeErrors['quote_content'] = "E_NULL";
			return false;
		}

		if ($this->__quote_content == $value)
			return true;

		$this->__set('quote_content', $value);
		return true;
	}

}
?>